3D Graphics Programming with QuickDraw 3D 1.5.4
Previous | QD3D Book | Overview | Chapter Contents | Next |
QuickDraw 3D provides routines that you can use to get a reference to a shared object or to get the type of a shared object.
You can use the Q3Shared_GetReference function to get a reference to a shared object.
TQ3SharedObject Q3Shared_GetReference (TQ3SharedObject sharedObject);
You can use the Q3Shared_IsReferenced function to determine whether a shared object has more than one reference to it.
TQ3Boolean Q3Shared_IsReferenced (TQ3SharedObject sharedObject);
The Q3Shared_IsReferenced function returns, as its function result, a Boolean value that indicates whether the shared object specified by the sharedObject parameter has more than one reference to it ( kQ3True ) or has only one reference to it ( kQ3False ).
The Q3Shared_IsReferenced function is intended for use by an application or other code that needs to determine whether it has the only existing reference to a shared object.
You can use the Q3Shared_GetType function to get the type of a shared object.
TQ3ObjectType Q3Shared_GetType (TQ3SharedObject sharedObject);
The Q3Shared_GetType function returns, as its function result, the type identifier of the shared object specified by the sharedObject parameter. If successful, Q3Shared_GetType returns one of these constants:
kQ3SharedTypeAttachment
kQ3SharedTypeControllerState
kQ3SharedTypeDrawContext
kQ3SharedTypeFile
kQ3SharedTypeReference
kQ3SharedTypeRenderer
kQ3SharedTypeSet
kQ3SharedTypeShape
kQ3SharedTypeShapePart
kQ3SharedTypeStorage
kQ3SharedTypeString
kQ3SharedTypeTexture
kQ3SharedTypeTracker
kQ3SharedTypeViewHints
If the type cannot be determined or is invalid, Q3Shared_GetType returns the value kQ3ObjectTypeInvalid .
You can use the Q3Shared_GetEditIndex function to get the edit index for a shared object.
unsigned long Q3Shared_GetEditIndex (TQ3SharedObject sharedObject);
The Q3Shared_GetEditIndex function returns, as its function result, the current edit index of the shared object specified by the sharedObject parameter. An edit index is a unique number associated with a shared object that changes each time the object is edited. You can use the edit index to determine whether an object you are caching has changed since the object was cached, using code such as the following:
struct -> editIndex = Q3Shared_GetEditIndex(foo);
struct -> object = Q3Shared_GetReference(foo);
Later you can determine if the object has been edited:
if (struct->editIndex !=
Q3Shared_GetEditIndex(struct->object)) {
/* Has been edited -- update or re-create caches. */
} else {
/* Not edited */
}
You can use the Q3Shared_Edited function to change a shared object's edit index.
TQ3Status Q3Shared_Edited (TQ3SharedObject sharedObject);
Previous | QD3D Book | Overview | Chapter Contents | Next |